import React, { Suspense } from "react";
import MyErrorBoundary from "./MyErrorBoundary";

// 组件懒加载
const OtherComponent = React.lazy(() => import('./OtherComponent'))
const AnotherComponent = React.lazy(() => import("./AnotherComponent"))
/**
 * 演示组件懒加载
 * @returns 
 */
export default function MyComponent() {
    return (
        <div>
            <MyErrorBoundary>
                <Suspense fallback={<div>Loading...</div>}>
                    <OtherComponent />
                    <AnotherComponent />
                </Suspense>
            </MyErrorBoundary>
        </div>
      );
}